/**
 * Created by wuyunan on 2017/5/19.
 */
import React from "react";

import PropTypes from "prop-types";
import {
  StyleSheet, Image, TouchableOpacity, SafeAreaView,
} from "react-native";
import { scale } from "../../common/index";
import NavigatorUtil from "../../utils/NavigatorUtil";

const BackArrow = props => {
  const { onPress } = props;
  return (
    <SafeAreaView>
      <TouchableOpacity style={styles.container} onPress={onPress}>
        <Image source={require("../../img/ic_back.png")} style={styles.image} />
      </TouchableOpacity>
    </SafeAreaView>
  );
};
BackArrow.defaultProps = {
  onPress: () => NavigatorUtil.goBack(),
};
BackArrow.propsTypes = {
  onPress: PropTypes.func,
};
const styles = StyleSheet.create({
  container: {
    height: scale * 48,
    width: scale * 48,
  },
  image: {
    height: scale * 48,
    width: scale * 48,
    resizeMode: "center",
  },
});
export default BackArrow;
